<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>三方手续费管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
    <script type="text/javascript">
        var grid = null;
        var callback = function () {
            grid.reload();
        };
        $(function () {
            $("#searchBar").ligerForm();
            $("#ligergrid1").ligerGrid({
                url: '<%=path%>/custpay/cmsPayComm/initCmsPayCommList.do',
                method : 'get',
                columns: [
                    { display: '事业部', name: 'isdept', minWidth: 100, align: 'center', enabledSort:true},
                    { display: '信联最低收取', name: 'xlMin', width: 80, align: 'center', enabledSort:true},
                    { display: '信联手续费比例', name: 'xlRate', width: 100, align: 'center', enabledSort:true},
                    { display: '信联最高收取', name: 'xlMax', width: 80, align: 'center', enabledSort:true},
                    { display: '手续费支付类型', name: 'paySide', width: 100, align: 'center', enabledSort:true},
                    { display: '狮桥支付短语', name: 'sqPayStr', minWidth: 150, align: 'center', enabledSort:true},
                    { display: '用户支付短语', name: 'usrPayStr', minWidth: 150, align: 'center', enabledSort:true},
                    { display: '免手续费短语', name: 'freePayStr', minWidth: 150, align: 'center', enabledSort:true},
                    {
                        display: '操作',width: 150,
                        render: function (rowdata, rowindex, value){
                            var h1 = '<a class="sq-button-hasicon" href="javascript:void(0);" onclick="modifycmspaycomm('+rowdata.id+')"><i class="sqBtnIco_4"></i>修改</a>'
                            var h2 = '<a class="sq-button-hasicon" href="javascript:void(0);" onclick="removecmspaycomm('+rowdata.id+')"><i class="sqBtnIco_7"></i>删除</a>';
                            return h1+h2;
                        }
                    }
                ],
                pageSize:10,
                root:'rows',
                record:'total',
                hideLoadButton : true,
                width: '100%',
                height:'100%',
                heightDiff:-2,
                //checkbox:true,
                rownumbers:true
            });
            grid = liger.get("ligergrid1");

            $("#searchBtn").click(function(event) {
                var form = new liger.get("searchBar");
                var data = form.getData();
                console.log(data);
                for (name in data){
                    grid.setParm(name,data[name]);
                };
                grid.reload();
            });
            $("#clearBtn").click(function(event) {
                clearLigerForm("searchBar");
            });
        });
        //格式化时间
        function renderDate(rowdata, index, value){
            var dateStr = "";
            if(null != value){
                var date = new Date(value);
                dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
            }
            return dateStr;
        }
        //修改
        function modifycmspaycomm(id){
            var tit = '新增三方手续费';
            var tabid='AddCmsPayComm';
            if(id!=''){
                tit = '修改三方手续费';
                tabid='ModifyCmsPayComm'+id;
            }
            Add_navTab(tabid, tit, '<%=path%>/custpay/cmsPayComm/modifyCmsPayCommPage.do?id='+id, callback);
        }
        //删除
        function removecmspaycomm(id){
            $.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
                if(flag == false)return;
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType:'json',
                    data:{id:JSON.stringify(id)},
                    url: '<%=path%>/custpay/cmsPayComm/removeCmsPayComm.do',
                    beforeSend: function(){
                        wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
                    },
                    success:function(msg){
                        wait_dialog.close();
                        if(msg.success == 1){
                            $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
                            grid.reload();
                        }else{
                            $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                        }
                    }
                });
            });
        }
    </script>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox col_33">
                    <div class="label">所属事业部</div>
                    <div class="field">
                        <select name="isdept"  id="isdept"  disabled="disabled">
                            <option value=" " selected="selected">--请选择--</option>
                            <option value="0000" >狮桥融资租赁</option>
                            <c:forEach items="${orglist}" var="opt">
                                <option value="${opt.key}">${opt.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                    <div style="display: none">
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_1"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_19"></i>清空</span>
                    <span id="addBtn" class="sq-button sq-button-hasicon" onclick="modifycmspaycomm('')"><i class="sqBtnIco_3"></i>新增</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>
</body>
</html>
